package org.dromara.tearoom.mqtt;

import lombok.extern.slf4j.Slf4j;
import org.dromara.tearoom.util.MqttUtil;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * MQTT启动
 * @author CKJ
 * @description: 订阅主题
 * @date 2025/4/15 18:44
 */
@Slf4j
@Order(1)
@Component
public class StartInit implements CommandLineRunner {

    @Resource
    MqttConfig mqttConfig;



    @Override
    public void run(String... args)  {
        log.info("==========mqtt启动 init==================");
        if(mqttConfig.connect()){
           MqttUtil.subscribeInit();
        }
    }

}
